package com.beordie.version_2.aop.interceptor;

import com.beordie.version_2.aop.aspect.BODAbstractAspectJAdvice;
import com.beordie.version_2.aop.config.BODJoinPoint;

import java.lang.reflect.Method;

/**
 * @Description
 * @Date 2022/2/22 15:12
 * @Created 30500
 */
public class BODBeforeAdviceInterceptor extends BODAbstractAspectJAdvice implements BODMethodInterceptor{
    /**
     * 参数
     */
    private BODJoinPoint joinPoint;

    public BODBeforeAdviceInterceptor(Object aspect, Method adviceMethod) {
        super(aspect, adviceMethod);
    }

    @Override
    public Object invoke(BODMethodInvocation invocation) throws Throwable {
        this.joinPoint = invocation;
        this.before(invocation.getMethod(), invocation.getArgument(), invocation.getThis());
        return invocation.procced();
    }

    public void before(Method method, Object[] arguments, Object aThis) throws Throwable{
        invokeAdviceMethod(this.joinPoint,null,null);
    }
}
